package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-08-05 9:16
 */
public class Solution_0744 {
    public char nextGreatestLetter(char[] letters, char target) {

        int showLocation = 0;
        int maxLength = Integer.MAX_VALUE;
        for (int i = 0; i < letters.length; i++) {
            if (letters[i] - target < maxLength && letters[i] - target > 0) {
                maxLength = letters[i] - target;
                showLocation = i;
            }
        }

        return letters[showLocation];

    }
}
